<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="firstname"> +
        <input type="text" v-model="lastname"> = 
        {{fullname}}
    </div>
</body>
<script>
    const vm = new Vue({
        el: '#app',
        data: {
            firstname: '',
            lastname: '',
            fullname: ''
        },
        watch: {
            firstname(newVal,oldVal) {
                console.log(oldVal,newVal);
                console.log("test 1");
                this.fullname = newVal + this.lastname;
            },
            lastname(newVal,oldVal) {
                console.log(oldVal,newVal);
                console.log("test 2");
                this.fullname = this.firstname + newVal;
            }
        }
    });
</script>
</html>